import pickle
import codecs
d = dict(name='Bob', age=20, score=88)
d_pickled = pickle.dumps(d)
print(d_pickled)
f = codecs.open('dump.txt', 'wb')
pickle.dump(d, f)
f.close()

f = codecs.open('./dump.txt', 'rb')
d = pickle.load(f)
f.close()
print(d)